<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
    <head>
        <title>新建网页</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="description" content="" />
        <meta name="keywords" content="" />
		
		

        <style type="text/css">
			div {width:300px; height:200px; background-color:lightblue;}
        </style>
    </head>
    <body>
        <h2>jquery事件绑定</h2>
        <div></div>
		
		<script src="../../js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
		
		<script type="text/javascript">
		//① bind()事件绑定使用
		//同一个对象绑定多个click事件
		/*$(function() {
			
		});*/
		
		$(function(){
			//addEventListener
		    $('div').bind('click',function(){
		        console.log('谁在碰我11？');
		    });
		    $('div').on('click',function(){
		        console.log('谁在碰我22？');
		    });
			$("div").click(function() {
			    console.log('谁在碰我33？');
		    });
		   
		    $('div').bind('click',function(){
		        console.log('谁又在碰我？');
		    });
		   
			$('div').on('mouseenter',function(){
		        //给div设置背景色
		        $(this).css('background-color','lightgreen');
		        //$('div').css('background-color','lightgreen');
		    });
			
		    $('div').on('mouseleave',function(){
		    	//this代表dom对象
		    	//$(this)将dom对象封装成jQuery对象
		        //给div设置背景色
		        $(this).css('background-color','lightblue');
		        //$('div').css('background-color','lightgreen');
		    });
		});
		</script>
    </body>
</html>